home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 120
/
Vol 120.iso
/
games
/
the_samu.swf
/
scripts
/
frame_5
/
DoAction.as
< prev
Wrap
Text File
|
2010-11-09
|
5KB
|
213 lines
function clearwudi()
{
clearInterval(wuditimer);
man._alpha = 100;
wudi = false;
}
function showLiquid()
{
i = 0;
while(i < liquids)
{
attachMovie("liquid","liquid" + i,i);
eval("liquid" + i)._xscale = eval("liquid" + i)._yscale = 80;
eval("liquid" + i)._x = 10 + i * 12;
eval("liquid" + i)._y = 188;
i++;
}
}
Key.addListener(this);
wudi = false;
onKeyDown = function()
{
if(Key.isDown(65))
{
if(liquids > 0)
{
liquids--;
removeMovieClip(_root["liquid" + liquids]);
wudi = true;
man._alpha = 50;
var _loc2_ = setInterval(clearwudi,2000);
showLiquid();
}
}
if(Key.isDown(70))
{
if(liquids > 0)
{
liquids--;
removeMovieClip(_root["liquid" + liquids]);
score += 50;
attachMovie("50mc","fenshu",10001);
fenshu._x = 280;
fenshu._y = 80;
showLiquid();
}
}
if(Key.isDown(80))
{
if(Pause)
{
menu.gotoAndStop(1);
Pause = false;
man.mc.play();
}
else
{
menu.gotoAndPlay(2);
Pause = true;
man.mc.stop();
}
}
};
backSound = new Sound();
backSound.attachSound("C42.WAV");
backSound.start(0,999);
hitSound = new Sound();
hitSound.attachSound("sound3.mp3");
upSound = new Sound();
upSound.attachSound("sound5.mp3");
spaceSound = new Sound();
spaceSound.attachSound("sound4.mp3");
stop();
x = 3.8;
jump = false;
Pause = false;
Lev = 1;
level = Lev + "/25";
life = 25;
liquids = 0;
score = 0;
man._alpha = 100;
lose = false;
GameOver = false;
_root.helpb._visible = false;
man.onEnterFrame = function()
{
if(!GameOver)
{
if(!Pause)
{
if(!lose)
{
this._x += x;
if(this.hitTest(liquid))
{
liquids++;
showLiquid();
liquid.swapDepths(_root.getNextHighestDepth());
removeMovieClip(liquid);
}
if(Key.isDown(38) || Key.isDown(32))
{
if(!jump)
{
key = Key.getCode();
if(key == 32)
{
spaceSound.start(0,1);
y = 14;
r = 12;
}
if(key == 38)
{
upSound.start(0,1);
y = 10;
r = 17;
}
maxFall = -15;
jump = true;
}
}
if(jump)
{
this.gotoAndStop(2);
if(maxFall < y)
{
y--;
}
this._y -= y;
this._rotation += r;
if(this._y >= 171)
{
this._rotation = 0;
this._y = 171;
jump = false;
}
}
else
{
this.gotoAndStop(1);
}
if(this._x > 610)
{
this._x = -20;
score += 100;
if(Lev < 25)
{
Lev++;
level = Lev + "/25";
_root.nextFrame();
}
else
{
backSound.stop();
i = 0;
while(i < liquids)
{
removeMovieClip(_root["liquid" + i]);
i++;
}
liquids = 0;
gotoAndStop(30);
_root.GameOver = true;
}
}
}
else
{
trace("X");
this._alpha -= 7;
this.mc.stop();
if(this._alpha <= 0)
{
life -= 1;
if(score > 0)
{
score -= 1;
}
hit = false;
if(life != 0)
{
this._x = -20;
this._y = 171;
jump = false;
this.gotoAndStop(1);
this._rotation = 0;
this._alpha = 100;
this.mc.play();
lose = false;
}
else
{
backSound.stop();
i = 0;
while(i < liquids)
{
removeMovieClip(_root["liquid" + i]);
i++;
}
liquids = 0;
this._x = -20;
this._y = 171;
this._alpha = 100;
gotoAndStop(31);
GameOver = true;
}
}
}
}
}
};